<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;


class City extends Model
{
    protected $table = 'love_city';

    public $timestamps = false;

    public function scopeProvince()
    {
        return $this->where('level', 1);
    }

    public function scopeCity()
    {
        return $this->where('level', 2);
    }

    public function scopeArea()
    {
        return $this->where('level', 3);
    }

    public static function options($id)
    {
        $data = static::find($id);
        if ($data){
            return [$data->id => $data->name];
        }else{
            return [];
        }
    }

}
